package cn.jaye.fabric.controller.rest;

import cn.jaye.fabric.application.MatchApplicationService;
import cn.jaye.fabric.common.util.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author Jaye
 * @create 2018-06-05 16:39
 */
@RestController
@RequestMapping("match")
public class MatchController {

    @Autowired
    private MatchApplicationService matchApplicationService;

    @PostMapping("/end/list")
    public String listEnd(HttpServletRequest request) {
        return ResultUtil.success(matchApplicationService.listEndMatch());
    }

    @PostMapping("/list/all")
    public String listAll(HttpServletRequest request) {
        return ResultUtil.success(matchApplicationService.listAllMatch());
    }

    @PostMapping("/guess/list")
    public String listGuess(HttpServletRequest request) {
        return ResultUtil.success(matchApplicationService.listInGuessMatch());
    }

    @PostMapping("/nostart/list")
    public String listStart(HttpServletRequest request) {
        return ResultUtil.success(matchApplicationService.listNoStartMatch());
    }
}
